package com.bhms.module.resources.dictionary.service;

import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;

import com.bhms.module.resources.dictionary.mapper.Dict;
import com.bhms.module.resources.dictionary.mapper.DictMapper;
import com.bhms.module.resources.dictionary.mapper.DictValues;

public class DictServiceBean implements DictService {

	private DictMapper dictMapper;

	/**
	 * 查询数据字典，按字典类型存放到hashmap中
	 * 
	 * @return
	 */
	@Override
	public Map<String, List<DictValues>> searchDict() {
		List<Dict> dictList = dictMapper.select();
		Map<String, List<DictValues>> map = new HashMap<String, List<DictValues>>();
		Iterator<Dict> it = dictList.iterator();
		while (it.hasNext()) {
			Dict dict = it.next();
			map.put(dict.getD_type(), dict.getValues());
		}
		return map;
	}

	public void setDictMapper(DictMapper dictMapper) {
		this.dictMapper = dictMapper;
	}

}
